package example.controller;

import example.utils.ResultData;
import io.jsonwebtoken.Claims;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/controller2")
@Api(value = "controller2", description = "controller2")
public class Controller2 {

    @RequestMapping("/haveAdmin/{index}")
    @ApiOperation(value = "验证权限", notes = "验证权限")
    public ResultData haveAdmin(@PathVariable Integer index, HttpServletRequest request) {
        Claims claims = (Claims) request.getAttribute("loginUser");
        return ResultData.ok(claims);
    }

}
